package com.test.nnooolwdeaer.bean_wooden;

import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.Suffix_Cote_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.Suffix_Ghana_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.Suffix_Kenya_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.Suffix_Nigeria_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.Suffix_Uganda_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.TimeZone_Cote_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.TimeZone_Ghana_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.TimeZone_Nigeria_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.TimeZone_Uganda_wooden;
import static com.test.nnooolwdeaer.constant_wooden.Constant_wooden.WordPrefix_wooden;

import java.util.TreeMap;

import android.text.TextUtils;

import com.test.nnooolwdeaer.bean_wooden.config_info_wooden.GlobalConfig_wooden;
import com.test.nnooolwdeaer.constant_wooden.Constant_wooden;
import com.test.nnooolwdeaer.constant_wooden.Url_wooden;
import com.test.nnooolwdeaer.util_wooden.StringUtil_wooden;
import com.test.nnooolwdeaer.util_wooden.analytics_wooden.timezone_wooden.TimeZoneUtil_wooden;
import com.test.nnooolwdeaer.util_wooden.helper_wooden.UserInfoHelper_wooden;

public class StaticVariate_wooden {

    public static String Upload_Info_Url_wooden = "";

    public static String Country_Word_wooden = "";

    public static String Select_Country_wooden = "";

    public static GlobalConfig_wooden.CountryConfig Country_Config_wooden;

    public final static TreeMap<String,String> Country_Suffix_Map_wooden = new TreeMap<String,String>(){{
        put(Constant_wooden.Country_Cote_wooden, Constant_wooden.Suffix_Cote_wooden);
        put(Constant_wooden.Country_Ghana_wooden, Constant_wooden.Suffix_Ghana_wooden);
        put(Constant_wooden.Country_Nigeria_wooden, Constant_wooden.Suffix_Nigeria_wooden);
        put(Constant_wooden.Country_Uganda_wooden, Constant_wooden.Suffix_Uganda_wooden);
        put(Constant_wooden.Country_Kenya_wooden, Suffix_Kenya_wooden);
        put(Constant_wooden.Country_Vietnam_wooden, Constant_wooden.Suffix_Vietnam_wooden);
    }};

    public final static TreeMap<String,String> Country_Money_Unit_Map_wooden = new TreeMap<String,String>(){{
        put(Constant_wooden.Country_Cote_wooden, Constant_wooden.Money_Unit_Cote_wooden);
        put(Constant_wooden.Country_Ghana_wooden, Constant_wooden.Money_Unit_Ghana_wooden);
        put(Constant_wooden.Country_Nigeria_wooden, Constant_wooden.Money_Unit_Nigeria_wooden);
        put(Constant_wooden.Country_Uganda_wooden, Constant_wooden.Money_Unit_Uganda_wooden);
        put(Constant_wooden.Country_Kenya_wooden, Constant_wooden.Money_Unit_Kenya_wooden);
        put(Constant_wooden.Country_Vietnam_wooden, Constant_wooden.Money_Unit_Vietnam_wooden);
    }};

    public final static TreeMap<String,String> Country_Mobile_Prefix_Map_wooden = new TreeMap<String,String>(){{
        put(Constant_wooden.Country_Cote_wooden,Constant_wooden.Mobile_Prefix_Cote_wooden);
        put(Constant_wooden.Country_Ghana_wooden,Constant_wooden.Mobile_Prefix_Ghana_wooden);
        put(Constant_wooden.Country_Nigeria_wooden,Constant_wooden.Mobile_Prefix_Nigeria_wooden);
        put(Constant_wooden.Country_Uganda_wooden,Constant_wooden.Mobile_Prefix_Uganda_wooden);
        put(Constant_wooden.Country_Kenya_wooden,Constant_wooden.Mobile_Prefix_Kenya_wooden);
        put(Constant_wooden.Country_Vietnam_wooden,Constant_wooden.Mobile_Prefix_Vietnam_wooden);
    }};

    public final static TreeMap<String,String> Test_Account_Map = new TreeMap<String,String>(){{
        put(Constant_wooden.Country_Cote_wooden,Constant_wooden.Test_Account_Token_Cote);
        put(Constant_wooden.Country_Ghana_wooden,Constant_wooden.Test_Account_Token_Ghana);
        put(Constant_wooden.Country_Nigeria_wooden,Constant_wooden.Test_Account_Token_Nigeria);
        put(Constant_wooden.Country_Uganda_wooden,Constant_wooden.Test_Account_Token_Uganda);
        put(Constant_wooden.Country_Kenya_wooden,Constant_wooden.Test_Account_Token_Kenya);
        put(Constant_wooden.Country_Vietnam_wooden,Constant_wooden.Test_Account_Token_Vietnam);
    }};

    public static String getMobilePrefix_wooden(){
        if (TextUtils.isEmpty(Select_Country_wooden)) return "";
        return Country_Mobile_Prefix_Map_wooden.get(Select_Country_wooden);
    }

    public static String getMoneyUnit_wooden(){
        if (TextUtils.isEmpty(Select_Country_wooden)) return "";
        return Country_Money_Unit_Map_wooden.get(Select_Country_wooden);
    }

    public static String getCountryUrlPrefix_wooden(){
        if (!TextUtils.isEmpty(Country_Word_wooden)) return "/" + Country_Word_wooden;

        //没有选择国家时根据时区默认返回
        return switch (TimeZoneUtil_wooden.INSTANCE.getTimeZoneID()) {
            case TimeZone_Nigeria_wooden -> "/" + WordPrefix_wooden + Suffix_Nigeria_wooden;
            case TimeZone_Ghana_wooden -> "/" + WordPrefix_wooden + Suffix_Ghana_wooden;
            case TimeZone_Cote_wooden -> "/" + WordPrefix_wooden + Suffix_Cote_wooden;
            case TimeZone_Uganda_wooden -> "/" + WordPrefix_wooden + Suffix_Uganda_wooden;
            default -> "/" + WordPrefix_wooden + Suffix_Kenya_wooden;
        };
    }

    public static String getBaseUrl(){
        if (TextUtils.isEmpty(Select_Country_wooden)) return Url_wooden.Url_Africa;
        if (Constant_wooden.Country_Vietnam_wooden.equals(Select_Country_wooden)) {
            return Url_wooden.Url_Asia;
        }
        return Url_wooden.Url_Africa;
    }

    public static boolean isTestAccount(){
        String token = Test_Account_Map.get(StringUtil_wooden.getSafeString_wooden(Select_Country_wooden));
        if (!TextUtils.isEmpty(token)) return token.equalsIgnoreCase(UserInfoHelper_wooden.getInstance_wooden().getToken_wooden());
        return false;
    }

}
